<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>注册</title>
</head>
<body>
<!--账号框、密码框、手机号、年龄和一个提交链接。-->
<h3>注册</h3>
账号：<input type="text" name="name" id="name"><br>
密码：<input type="text" name="password" id="password"><br>
电话：<input type="text" name="phone" id="phone"><br>
年龄：<input type="text" name="age" id="age"><br>
<button onclick="registered()">注 册</button>
<script type="text/javascript" src="../static/js/jquery.js"></script>
<script type="text/javascript">
    function registered() {
        var name=$("#name").val();
        var password=$("#password").val();
        $.ajax({
            url:"http://localhost:8080/login",
            type:'post',
            data:{
                name:name,
                password:password
            },
            success:function (res){
                if(res===1||res===2){
                    alert("注册失败");
                }else{
                    alert("注册成功");
                }
            }
        })

    }
</script>
</body>
</html>